-
Notifications
You must be signed in to change notification settings - Fork 0
feat: teacher game preview #34
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sindrelm
approved these changes
Apr 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional feedback given by codex
- Revoke the old refresh token before leaving the auth cookie path — /home/sindre/Documents/NTNU/vår26/IDATT2106/nettdetektivene/backend/src/main/kotlin/edu/ntnu/idi/idatt/backend/classroom/api/GamePreviewSessionController.kt:30-33
startPreviewSession tries to rotate the caller’s refresh token by reading it from request.cookies, but this endpoint lives under /api/v1/classrooms/...
while the configured refresh cookie path is /api/v1/auth (see src/test/resources/application.properties and .env.example). In a real browser that cookie
is therefore not sent here, extractRefreshCookie(request) resolves to null, and the previous teacher refresh token stays active after entering preview. That leaves an extra non-preview refresh token valid server-side and defeats the intended session rotation for every normal browser client. - Derive viewAs from existing tokens instead of defaulting to teacher — /home/sindre/Documents/NTNU/vår26/IDATT2106/nettdetektivene/backend/src/main/kotlin/edu/ntnu/idi/idatt/backend/iam/security/SecurityConfig.kt:168-169
For access tokens issued before this change, the new view_as claim is absent. toAuthentication now falls back to ViewAs.TEACHER unconditionally, so any
still-valid pupil token is rehydrated as viewAs=TEACHER until the user refreshes or logs in again. That makes /api/v1/auth/me return the wrong session
metadata during rollout and will misclassify legacy sessions anywhere the new field is consumed.
src/main/kotlin/edu/ntnu/idi/idatt/backend/iam/application/CurrentUserResolver.kt
Outdated
Show resolved
Hide resolved
sindrelm
requested changes
Apr 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see previous comments
sindrelm
approved these changes
Apr 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Sign in
to join this conversation on GitHub.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.